#include<bits/stdc++.h>
#define int long long
using namespace std;
bool st;
const double PI=acos(-1.0);
int n,m,T=1,t[35],len;
struct cp{
    double x,y;
    cp operator + (const cp &A) const{
        return (cp){x+A.x,y+A.y};
    }
    cp operator - (const cp &A) const{
        return (cp){x-A.x,y-A.y};
    }
    cp operator * (const cp &A) const{
        return (cp){x*A.x-y*A.y,x*A.y+y*A.x};
    }
}a[3000005],buf[3000005],w[3000005];
bool ed;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
inline cp js(int x,int y){
    if(y<0) y+=x;
    return (cp){cos(PI*2.0*((double)y/(double)x)),sin(PI*2.0*((double)y/(double)x))};
}
inline void fft(cp *A,int op){
    for(int i=0;i<T;i++){
        for(int j=0;j<len;j++) t[j]=((i&(1<<j))>0);
        reverse(t,t+len);
        int o=0;
        for(int j=0;j<len;j++) if(t[j]) o+=(1<<j);
        buf[o]=A[i];
    }
    for(int i=0;i<T;i++) A[i]=buf[i];
    for(int i=1;i<T;i<<=1){
        w[0]=js(i<<1,0);w[1]=js(i<<1,1*op);
        for(int j=2;j<i;j++) w[j]=w[j-1]*w[1];
        for(int j=0;j<T;j+=(i<<1)){
            for(int g=0;g<i;g++){
                cp x=w[g]*A[j+g+i];
                A[j+g+i]=A[j+g]-x;
                A[j+g]=A[j+g]+x;
            }
        }
    }
}
signed main(){
    // cerr<<(double)(&st-&ed)/1024.0/1024.0<<"MB\n";
    n=read(),m=read();
    for(int i=0;i<=n;i++) a[i].x=read();
    for(int i=0;i<=m;i++) a[i].y=read();
    while(T<=(n+m)) T<<=1;
    len=log2(T);
    fft(a,1);
    for(int i=0;i<T;i++) a[i]=a[i]*a[i];
    fft(a,-1);
    for(int i=0;i<=(n+m);i++){
        double q=a[i].y/2.0/(double)T;
        cout<<(int)(q+0.5)<<" ";
    }
    // cerr<<(double)clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}
